package com.hailong.zyt.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hailong.zyt.beans.HomeworkStudent;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hailong.zyt.beans.Student;
import com.sun.deploy.net.HttpResponse;
import org.springframework.ui.Model;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author hailong
 * @since 2021-06-01
 */
public interface HomeworkStudentService extends IService<HomeworkStudent> {

    //根据作业id返回每个学生的作业
    IPage<HomeworkStudent> getStudentHomeworkByHwId(Integer nowPage, Long hwId);

    //查找为完成作业的学生
    List<Student> getStudentNotFinished(Long hwId);

    //查找某一个具体作业
    HomeworkStudent getOneHomework(Long hwId, Long stuId);

    //批改作业
    int saveHomework(HomeworkStudent homeworkStudent, Model model);

    //提交作业
    int submitHomework(HomeworkStudent homework, Student student, MultipartFile file) throws IOException;

    //下载附件
    void downloadFile(String fileName, HttpServletResponse response) throws IOException;

    //查询某个作业完成状况
    Integer getHomeworkState(Long hwId, Long stuId);
}
